package org.unicen.exa.io.worker.assigner;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.unicen.exa.io.worker.assigner.algorithm.Assigner;
import org.unicen.exa.io.worker.assigner.input.CreatorJobs;
import org.unicen.exa.io.worker.assigner.input.HandlerInstances;

public class Main {
	
	private static final Logger logger = Logger.getLogger(Main.class);
	
	public static void main(String[] args) {
		
		
		ApplicationContext applicationContextExample = new ClassPathXmlApplicationContext( "applicationContext.xml" );
		HandlerInstances handlerInstances = (HandlerInstances) applicationContextExample.getBean( "handlerInstances" );
		Assigner assigner = (Assigner) applicationContextExample.getBean( "assigner" );
		CreatorJobs creatorJobs = (CreatorJobs) applicationContextExample.getBean( "creatorJobs" );
		
//		EntropiaInstances entropiaInstances = (EntropiaInstances) applicationContextExample.getBean( "entropiaInstances" );
		
		logger.debug(String.format("STARTING"));
		
		
		ExecutorService executor = Executors.newFixedThreadPool(3);
		executor.submit(creatorJobs);
		executor.submit(handlerInstances);
		executor.submit(assigner);
//		executor.submit(entropiaInstances);
		
		
		
		
		
	}

}
